package com.enjoy.jvm.hotspot.src.share.vm.runtime;

import com.enjoy.jvm.hotspot.src.share.vm.memory.AllStatic;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;


@EqualsAndHashCode(callSuper = true)
@Data
public class Threads extends AllStatic {

    /**
     * 所有的Java基本线程全部存储在这个list中
     */
    @Getter
    private static List<Thread> threadList;


    private static Thread currentThread;

    static {
        threadList = new ArrayList<>();
    }

    public static JavaThread currentThread() {
        return (JavaThread) currentThread;
    }


    public static void setCurrentThread(Thread thread) {
        currentThread = thread;
    }

}
